<template>
  <div class="info">
    <div class="info-bar">我的位置 > 首页 > 专辑 > 花香怒放</div>
    <div class="info-wrap">
      <div class="left">
        <img :src="picUrl" alt="" />
        <div>
          <div class="left-all-bofang">
            <span class="iconfont icon-bofang" />全部播放
          </div>
          <div class="text">专辑名：{{ name }}</div>
          <div class="text">歌手： {{ author }}</div>
          <div class="text">发行时间：2022-11-11</div>
          <p v-if="!!albumItem.description">
            <span>简介：</span>
            {{ albumItem.description }}
          </p>
        </div>
      </div>
      <div class="right">
        <div class="info-title">&lt;{{ name }}&gt; -歌曲列表</div>
        <div class="all-checkout-bar">
          <span class="checkbox">
            <input
              type="checkbox"
              checked="true"
              style="margin-right: 5px"
            />全选
          </span>
          <div class="right-bofang">
            <div class="right-bf"><em class="iconfont icon-bofang" />播放</div>
            <div class="right-all-bofang">
              <em class="iconfont icon-bofang" />全部播放
            </div>
          </div>
        </div>
        <ul class="song-ul">
          <li v-for="song in albumSongs" :key="song.id">
            <div class="song">
              <div>
                <input
                  type="checkbox"
                  name="checkout-item"
                  class="checkout-item"
                />
                <span
                  ><em style="margin: 0 10px">01</em>{{ song.name }} -
                  {{ author }}</span
                >
              </div>
              <div>
                <span class="iconfont icon-erji"></span>
                <span class="iconfont icon-fenxiang" style="padding: 0 10px">
                </span>
              </div>
            </div>
          </li>
        </ul>
        <div class="other-container">
          <div class="other">其他专辑</div>
          <ul class="outer-wrap">
            <li class="other-item">
              <img src="../Album/images/03.jpg" alt="" class="other-img" />
              <div class="other-name">逆</div>
            </li>
            <li class="other-item">
              <img src="../Album/images/05.jpg" alt="" class="other-img" />
              <div class="other-name">花香怒放</div>
            </li>
            <li class="other-item">
              <img src="../Album/images/02.jpg" alt="" class="other-img" />
              <div class="other-name">涂鸦森林</div>
            </li>
            <li class="other-item">
              <img src="../Album/images/04.jpg" alt="" class="other-img" />
              <div class="other-name">我们</div>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { reqAlbumItemApi } from "@/api/index";

export default {
  name: "AlbumInfo",
  data() {
    return {
      albumItem: [],
      albumSongs: [],
      author: "",
      name: "",
      picUrl: "",
      id: this.$route.query.albumId,
    };
  },
  mounted() {
    // const id = this.$route.query.id;
    this.AlbumItemList();
  },
  methods: {
    async AlbumItemList() {
      console.log(this.$route.query, "query");
      const result = await reqAlbumItemApi(this.id);
      console.log(result);
      this.albumItem = result.album;
      this.albumSongs = result.songs;
      this.author = result.songs[0].ar[0].name;
      this.name = result.songs[0].name;
      this.picUrl = result.songs[0].al.picUrl;
    },
  },
};
</script>

<style lang="less" scoped>
.info {
  width: 1000px;
  margin: 0 auto;
  margin-top: 10px;
}
.info-bar {
  height: 30px;
  line-height: 30px;
  font-size: 14px;
}
.info-wrap {
  display: flex;
  margin-top: 20px;
}
.left {
  width: 180px;
  padding-bottom: 50px;
  border-right: 1px solid #dcdcdc;
}
img {
  width: 148px;
  height: 148px;
  box-shadow: 0px 4px 8px;
}
.left-all-bofang {
  margin: 10px 0;
  // border: 1px solid red;
  height: 28px;
  line-height: 28px;
  width: 120px;
  font: size 16px;
  color: #fff;
  background-color: #7cdbff;
  .icon-bofang {
    font-size: 20px;
    padding: 0 5px;
  }
}
.text {
  margin: 10px 0;
}
p {
  width: 160px;
  height: 300px;
  // border: 1px solid green;
  line-height: 24px;
  // overflow: scroll;
  // overflow-y: scroll;
  overflow: hidden;
}
.right {
  width: 780px;
  padding-left: 10px;
}
.info-title {
  margin: 10px 0;
  font-size: 16px;
  font-weight: 600;
}
.all-checkout-bar {
  display: flex;
  justify-content: space-between;
  height: 30px;
  line-height: 30px;
  padding-bottom: 5px;
  border-bottom: 1px solid #dcdcdc;
}
.checkbox {
  line-height: 40px;
  font-size: 14px;
}
.right-bofang {
  display: flex;
  color: #fff;
  .right-bf {
    padding: 0 10px;
    background-color: #7cdbff;
  }
  .right-all-bofang {
    padding-left: 10px;
    padding-right: 10px;
    margin-left: 10px;
    background-color: #7cdbff;
  }
}

.song-ul {
  margin-top: 8px;
  min-height: 100px;
}
.song {
  display: flex;
  justify-content: space-between;
  height: 30px;
  line-height: 30px;
  font-size: 14px;
}
.other-container {
  margin: 10px 0;
}
.other {
  padding: 10px 0;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid #dcdcdc;
}
.outer-wrap {
  display: flex;
}
.other-item {
  margin: 0 20px;
}
.other-img {
  margin: 20px 0px;
  width: 100px;
  height: 100px;
  background: url("../Album/images/other.png") no-repeat -119px -412px;
}
</style>
